package com.example.forum_system.controller;

import com.example.forum_system.common.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.*;

/**
 * @BelongsProject: 0.forum_system
 * @BelongsPackage: com.example.forum_system.controller
 * @Author : 游在海里的鱼
 * @CreateTime : 2023-11-03  15:18
 * @Version : 1.0
 * @Description : TODO
 */
@Api(tags = "测试类的相关接口")
@RestController
@RequestMapping("/test")
public class TestController {

    @ApiOperation("测试接口一，打印“hello word”")
    @GetMapping("/print")
    public Result print(){
        return Result.success("hello word");
    }

    @ApiOperation("测试接口二，异常处理")
    @GetMapping("/exception")
    public void exception(){
        int i = 2/0;
    }

    @ApiOperation("测试接口三，传参检验")
    @PostMapping("/parameter")
    public Result parameter(@ApiParam("姓名") @RequestParam("name") String name){
        return Result.success("hello"+name);
    }

}
